const ll inf = 1e18;
struct SegNode {
	ll mxi, mxj, mxv;
  SegNode() : mxi(-inf), mxj(-inf), mxv(-inf) {}
  SegNode(ll mxi_, ll mxj_, ll mxv_) : mxi(mxi_), mxj(mxj_), mxv(mxv_) {} 
};

SegNode operator+(SegNode lhs, SegNode rhs) {
	SegNode t;
  t.mxi = max(lhs.mxi, rhs.mxi);
  t.mxj = max(lhs.mxj, rhs.mxj);
  t.mxv = max(lhs.mxv, rhs.mxv);
	return t;
};

void solve()
{
  int n, m;
  cin >> n >> m;

  map<ll, ll> p;
  vi x(n + 1), v(n + 1), pos;
  vector<pll> seg;
  rep(i, 1, n) {
    cin >> x[i] >> v[i];
    p[x[i]] += v[i];
    pos.pb(x[i]);
    pos.pb(x[i] - v[i]);
    pos.pb(x[i] + v[i]);
    seg.pb({x[i], v[i]});
  }
  sort(all(pos));
  sort(all(seg));
  pos.erase(unique(all(pos)), pos.end());
  auto get = [&](int p) {
    return lower_bound(all(pos), p) - pos.begin() + 1;
  };

  vl V(sz(pos) + 1);
  ll sum = 0, c = 0;
  priority_queue<ll, vector<ll>, greater<ll>> Q;
  map<ll, vl> cnt;
  rep(i, 0, sz(seg) - 1) {
    while (!Q.empty() && seg[i].fi >= Q.top()) {
      sum -= Q.top();
      c--;
      Q.pop();
    }
    V[get(seg[i].fi)] += sum - c * seg[i].fi;
    cnt[get(seg[i].fi)].pb(sum - c * seg[i].fi);
    c++;
    sum += seg[i].fi + seg[i].se;
    Q.push(seg[i].fi + seg[i].se);
  }
  for (auto &[x, val]: cnt) {
    if (sz(val) > 1) {
      per(i, sz(val) - 1, 1) {
        V[x] -= val[i];
      }
    }
  }
  cnt.clear();
  priority_queue<ll> Q2;
  c = 0, sum = 0;
  per(i, sz(seg) - 1, 0) {
    while (!Q2.empty() && seg[i].fi <= Q2.top()) {
      sum += Q2.top();
      c--;
      Q2.pop();
    }
    V[get(seg[i].fi)] += sum + c * seg[i].fi;
    cnt[get(seg[i].fi)].pb(sum + c * seg[i].fi);
    c++;
    sum += seg[i].se - seg[i].fi;
    Q2.push(seg[i].fi - seg[i].se);
  }
  for (auto &[x, val]: cnt) {
    if (sz(val) > 1) {
      per(i, sz(val) - 1, 1) {
        V[x] -= val[i];
      }
    }
  }
  rep(i, 0, sz(seg) - 1) {
    V[get(seg[i].fi)] += seg[i].se;
  }
  
  vector<SegNode> val(sz(V));
  rep(i, 1, sz(pos)) {
    val[i] = SegNode(V[i] - pos[i - 1], V[i] + pos[i - 1], V[i]);
  }
  SegTree<SegNode> tr(val);
  int N = sz(pos);
  rep(i, 1, n) {
    int l = get(x[i] - v[i]);
    int r = get(x[i] + v[i]);
    int p = get(x[i]);

    auto t1 = tr.query(l, p);
    auto t2 = tr.query(p, r);
    ll ret = 0;
    ret = max(ret, t1.mxi + x[i] - v[i]);
    ret = max(ret, t2.mxj - x[i] - v[i]);
    if (l > 1) {
      auto t = tr.query(1, l - 1);
      ret = max(ret, t.mxv);
    }
    if (r < N) {
      auto t = tr.query(r + 1, N);
      ret = max(ret, t.mxv);
    }
    if (ret > m) {
      cout << 0;
    } else {
      cout << 1;
    }
  }
  cout << '\n';
}